﻿// 需要拦截器的地方使用instance对象， 有自定义返回逻辑的地方沿用axios，在组件内部处理返回结果即可
import request from '/@/utils/request';

export default function () {
    /**
     * 退订分页查询
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const queryUnsubscribeRecord = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Unsubscribe/UnsubscribeQueryPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 投诉分页查询
     * @returns 返回接口数据
     */
    const queryComplaintRecord = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Unsubscribe/ComplaintQueryPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 导出Excel文件
     * @param params 要传的参数值
     * @returns 返回Excel文件
     */
    const unsubscribeExportExcel = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Unsubscribe/UnsubscribeExportExcel",
            method: "post",
            headers: { 'Content-Type': 'application/json-patch+json' },
            data: params,
            responseType: 'blob'
        });
    };

    /**
     * 导出Excel文件
     * @param params 要传的参数值
     * @returns 返回Excel文件
     */
    const complaintExportExcel = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Unsubscribe/ComplaintExportExcel",
            method: "post",
            headers: { 'Content-Type': 'application/json-patch+json' },
            data: params,
            responseType: 'blob'
        });
    };

    return {
        queryUnsubscribeRecord,
        queryComplaintRecord,
        unsubscribeExportExcel,
        complaintExportExcel
    };
}
